from django.urls import path, include, re_path
from django.views.static import serve
from django.conf import settings
from ywadmin.settings import MEDIA_ROOT
from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView, TokenVerifyView

urlpatterns = [
    # 系统管理
    path('system/', include('system.urls')),
    # 任务管理
    path('tasks/', include('tasks.urls')),
    # Simple JWT的令牌视图
    path('api/token/', TokenObtainPairView.as_view(), name='token_obtain_pair'),  # 获取令牌
    path('api/token/refresh/', TokenRefreshView.as_view(), name='token_refresh'),  # 刷新令牌
    path('api/token/verify/', TokenVerifyView.as_view(), name='token_verify'),  # 验证令牌
    re_path(r'media/(?P<path>.*)', serve, {'document_root': MEDIA_ROOT}, name='media'),
]
